
console.log(null === null);

var arr = ['小明', '小红', '大军', '阿黄', '阿紫', '阿兰', '阿绿', '阿红', '阿黑'];



arr.sortName=function(){
    if(arr.length===0){
        console.log("没有同学来报名");
    }else if(arr.length === 1){
        console.log('欢迎'+arr+'同学');
    }else {
        console.log('欢迎' + arr.slice(0, arr.length - 1) + '和' + arr[length] + '同学');

    }
}
arr.sortName();

//console.log((arr.splice(0, 3)));



var str = ["flower", "flow", "flight"]




var strStr = function (haystack, needle) {
    if (needle === "") return 0;
    for (var i = 0; i < haystack.length; i++) {
        if (haystack[i] = needle[0]) {
            if (haystack.substring(i, i + needle.length) === needle)
                return i

        }
    }
    return -1

};
;

console.log(strStr('hello','ll'));


//https://leetcode-cn.com/problems/longest-common-prefix/solution/javascriptjie-fa-tong-su-yi-dong-zui-cha-hm82/